import instance from "@/utils/request"

// 获取角色列表
export function getRoleList( page) {
    return instance({
        url: `/sys/role?page=${page}&pagesize=5`,
        method: "get"
    })
}

// 添加角色
export function addRole(data) {
    return instance({
        url: "/sys/role",
        method: "post",
        data
    })
}

// 删除角色
export function deleteRole(id) {
    return instance({
        url: `/sys/role/${id}`,
        method: "delete"
    })
}

// 获取角色详情
export function getRoleDetail(id) {
    return instance({
        url: `/sys/role/${id}`,
        method: "get"
    })
}
// 获取权限
export function getPermission() {
    return instance({
        url: `sys/permission`,
        method: "get"
    })
}

// 修改权限
export function updatePermission(data) {
    return instance({
        url: `/sys/role/assignPrem`,
        method: "put",
        data
    })
}
// 编辑权限
export function editPermission(id,data) {
    return instance({
        url: `/sys/role/${id}`,
        method: "put",
        data
    })
}